/* 人机验证组件样式 */

.captcha-trigger-btn {
  margin-left: 8px;
}

.captcha-modal .ant-modal-content {
  border-radius: 12px;
  overflow: hidden;
}

.captcha-modal .ant-modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom: none;
}

.captcha-modal .ant-modal-title {
  color: white;
  font-weight: 600;
}

.captcha-container {
  padding: 20px;
}

/* 验证类型选择器 */
.verification-type-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
}

.verification-type-selector .ant-btn {
  border-radius: 8px;
  font-weight: 500;
}

/* 验证区域 */
.verification-area {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 12px;
  margin-bottom: 20px;
  position: relative;
}

/* 加载区域 */
.loading-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 滑块验证样式 */
.slider-verification {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.slider-container {
  position: relative;
  width: 100%;
  height: 60px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(59,130,246,0.08);
  user-select: none;
  transition: border-color 0.2s;
}
.slider-container.dragging {
  border-color: #3b82f6;
  box-shadow: 0 4px 20px rgba(59,130,246,0.18);
}
.slider-track {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #e0f2fe 0%, #f0fdfa 100%);
}
.slider-target {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 40px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 8px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  z-index: 1;
}
.target-pulse {
  animation: targetPulse 1.2s infinite;
}
@keyframes targetPulse {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.3); }
  70% { box-shadow: 0 0 0 12px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.slider-handle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 40px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 8px;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.18);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 20px;
  z-index: 2;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  user-select: none;
}
.slider-handle:active {
  cursor: grabbing;
  transform: translateY(-50%) scale(0.97);
}
.slider-handle.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  animation: successPulse 0.6s;
}
@keyframes successPulse {
  0% { transform: translateY(-50%) scale(1); }
  50% { transform: translateY(-50%) scale(1.08); }
  100% { transform: translateY(-50%) scale(1); }
}
.slider-handle.error {
  animation: errorShake 0.4s;
}
@keyframes errorShake {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  25% { transform: translateY(-50%) translateX(-8px); }
  75% { transform: translateY(-50%) translateX(8px); }
}

/* 禁止文本选中 */
.slider-verification, .slider-container, .slider-handle, .slider-track, .slider-target {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 点击验证样式 */
.click-verification {
  text-align: center;
}

.click-canvas {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: crosshair;
  background: #ffffff;
  margin-bottom: 16px;
}

.click-canvas:hover {
  border-color: #3b82f6;
}

/* 拼图验证样式 */
.puzzle-verification {
  text-align: center;
}

.puzzle-canvas {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  background: #ffffff;
  margin-bottom: 16px;
}

.puzzle-canvas:hover {
  border-color: #3b82f6;
}

/* 验证提示文本 */
.verification-tip {
  color: #6b7280;
  font-size: 14px;
  margin: 0;
  font-weight: 500;
}

/* 操作按钮区域 */
.verification-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.verification-actions .ant-btn {
  border-radius: 8px;
  font-weight: 500;
  min-width: 100px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .captcha-modal {
    width: 90% !important;
    max-width: 400px;
  }
  
  .captcha-container {
    padding: 16px;
  }
  
  .verification-area {
    min-height: 250px;
  }
  
  .slider-container {
    height: 50px;
  }
  
  .slider-handle,
  .slider-target {
    width: 50px;
    height: 35px;
  }
  
  .click-canvas,
  .puzzle-canvas {
    width: 280px;
    height: 180px;
  }
  
  .verification-type-selector {
    flex-wrap: wrap;
  }
  
  .verification-type-selector .ant-btn {
    flex: 1;
    min-width: 80px;
  }
}

/* 深色主题适配 */
[data-theme="dark"] .captcha-modal .ant-modal-content {
  background: #1f1f1f;
  color: #ffffff;
}

[data-theme="dark"] .captcha-modal .ant-modal-header {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

[data-theme="dark"] .verification-area {
  background: #262626;
}

[data-theme="dark"] .slider-container {
  background: #2f2f2f;
  border-color: #434343;
}

[data-theme="dark"] .click-canvas,
[data-theme="dark"] .puzzle-canvas {
  background: #2f2f2f;
  border-color: #434343;
}

[data-theme="dark"] .verification-tip {
  color: #bfbfbf;
}

/* 动画效果 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.captcha-container {
  animation: slideIn 0.3s ease-out;
}

/* 成功状态动画 */
@keyframes successPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.slider-handle.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  animation: successPulse 0.6s ease-in-out;
}

/* 错误状态动画 */
@keyframes errorShake {
  0%, 100% {
    transform: translateY(-50%) translateX(0);
  }
  25% {
    transform: translateY(-50%) translateX(-5px);
  }
  75% {
    transform: translateY(-50%) translateX(5px);
  }
}

.slider-handle.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  animation: errorShake 0.4s ease-in-out;
}

/* 拼图块选中状态 */
.puzzle-piece-selected {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
  transform: scale(1.05);
}

/* 点击目标高亮 */
.click-target-highlight {
  filter: brightness(1.2);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
} 